package com.gitee.chenyaohua.oa.domain;

import java.time.LocalDateTime;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import lombok.Data;


@Data
@Entity
@Table(name="t_role")
public class TRole {
	
	@Column(name = "role_name",nullable = false,length = 20)
	private String roleName;
	
	@Id
	@Column(name = "role_id")
	@GeneratedValue(generator = "idGenerator", strategy = GenerationType.SEQUENCE)
	@GenericGenerator(name = "idGenerator", strategy = "com.gitee.chenyaohua.oa.util.hibernate.ext.TimeBaseIdGenerator")    
	private String roleId;
	
	@Column(name = "create_date",nullable = false)
	private LocalDateTime createDate;
	
	@Column(name = "update_date",nullable = false)
	private LocalDateTime updateDate;
	
	@ManyToMany
	private List<TRight> rights;
	
	@ManyToMany(mappedBy = "roles")
	private List<TUser> users;
	
}
